//
//  ZhStaffTabBarViewController.m
//  BuyProvince
//
//  Created by zhangliwen on 2018/7/3.
//  Copyright © 2018年 zhangliwen. All rights reserved.
//

#import "ZhStaffTabBarViewController.h"
#import "ZH_HomeViewController.h"
#import "ZH_InsitutionsViewController.h"
#import "ZH_MallViewController.h"
#import "ZH_MineViewController.h"
#import "ZH_LookTeacherViewController.h"

@interface ZhStaffTabBarViewController ()<UITabBarControllerDelegate>

@end

@implementation ZhStaffTabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self loadSubView];
}

//加载子视图
- (void)loadSubView
{
    UIViewController *nav0 = [[Hen_BaseNavigationViewController alloc] initWithRootViewController:[[ZH_HomeViewController alloc] init]];
    
    UIViewController *nav1 = [[Hen_BaseNavigationViewController alloc] initWithRootViewController:[[ZH_InsitutionsViewController alloc] init]];
    
    UIViewController *nav2 = [[Hen_BaseNavigationViewController alloc] initWithRootViewController:[[ZH_MallViewController alloc] init]];
    
    UIViewController *nav3 = [[Hen_BaseNavigationViewController alloc] initWithRootViewController:[[ZH_LookTeacherViewController alloc] init]];
    
    UIViewController *nav4 = [[Hen_BaseNavigationViewController alloc] initWithRootViewController:[[ZH_MineViewController alloc] init]];
    
    NSArray *itemTitles = @[@"首页",
                            @"机构",
                            @"商场",
                            @"找老师",
                            @"我的"];
    
    self.viewControllers = @[nav0,nav1,nav2,nav3,nav4];
    self.tabBar.translucent = NO;
//    self.tabBar.frame.origin.y = FITHEIGHT(64);
    self.view.backgroundColor = [UIColor colorWithHexString:@"#ffffff"];
    
    //tabbbr颜色
    [self.tabBar setBarTintColor:[UIColor colorWithHexString:@"#ffffff"]];
    self.tabBar.translucent = NO;
    //设置跳转是隐藏
    self.hidesBottomBarWhenPushed = YES;
    //设置选中项
    [self setSelectedIndex:0];
    //代理
    self.delegate = self;
    
    //设置图片
    //@"quickplay_tabbar_normal.png"
    NSArray *imageName = @[@"icon_home",
                           @"icon_jg",
                           @"icon_mall",
                           @"icon_teacher",
                           @"icon_my"];
    //@"quickplay_tabbar_select.png"
    NSArray *selectImageName = @[@"icon_home_selected",
                                 @"icon_jg_selected",
                                 @"icon_mall_selected",
                                 @"icon_teacher_selected",
                                 @"icon_my_selected"];
    
    for (int i = 0; i < self.tabBar.items.count; i ++) {
        UITabBarItem *barItem = self.tabBar.items[i];
        //设置字体和颜色
        barItem.title = itemTitles[i];
        
        //正常字体
        [barItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:kFontColorBlack,NSForegroundColorAttributeName,kFontSize_24,NSFontAttributeName, nil] forState:UIControlStateNormal];
        
    
            //选中字体
            [barItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor colorWithHexString:@"#00C9AE"],NSForegroundColorAttributeName,kFontSize_24,NSFontAttributeName, nil] forState:UIControlStateSelected];
        
        //正常图标
        barItem.image = [[UIImage imageNamed:imageName[i]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
//        barItem.imageInsets = UIEdgeInsetsMake(0, 0, 0, 0);
        //选中图标
        barItem.selectedImage = [[UIImage imageNamed:selectImageName[i]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
        
    }
    
    //分界线
    //    UIImageView *lineImage = [UIImageView createImageViewWithName:@"public_line"];
    //    [self.view addSubview:lineImage];
    //    [lineImage mas_makeConstraints:^(MASConstraintMaker *make) {
    //        make.centerX.equalTo(self.view);
    //        make.width.equalTo(self.view);
    //        make.top.equalTo(self.view);
    //    }];
}



@end
